<?php
header("Access-Control-Allow-origin:*");

$page = $_POST["page"] ? $_POST["page"] : 1;
$pagesize = $_POST["pagesize"] ? $_POST["pagesize"] : 20;
$arr = [];
$resArr = [];
$start = ($page - 1) * $pagesize + 1;
$end = $page * $pagesize;
$type=$_POST["type"] ? $_POST["type"] : 0;

if ($page == 5) {
    $end = $page * $pagesize - 5;
}

$randon=1; //判断是否返回空

$statusFX=array(-99,1,99);
$statusTX=array(-99,1,2,99);
$statusFXName=array("审核不通过","待放款","已入账");
$statusTXName=array("提现失败","待处理","处理中","已完成");

if(!!$randon){
	for ($i = $start; $i <= $end; $i++) {
        $zjRandon=mt_rand(1,2);

        $randonFX=mt_rand(0,2);

        $randonTX=mt_rand(0,3);
       
		if($type==0){
			$arr["bills"][] = array(
            "id" => $i,
            "typeno"=>$zjRandon,
            "name" =>($zjRandon==1 ? "xx佣金收入":"xx提现"). $i,
            "typeintro" =>($zjRandon==1 ? "xx报备佣金". $i:""),
            "money" =>$i,
            "time"=>"18-08-30 19:55",
            "status"=>($zjRandon==1 ? $statusFX[$randonFX]:$statusTX[$randonTX]),
            "statusname"=>($zjRandon==1 ? $statusFXName[$randonFX] :$statusTXName[$randonTX])
        	);
		}elseif($type==1){
            
			 $arr["bills"][] = array(
            "id" => $i,
            "typeno"=>1,
            "typeintro" =>"xx报备佣金". $i,
            "name" => "佣金-" . $i,
            "money" =>$i,
            "time"=>"18-08-30 19:55",
            "status"=>$statusFX[$randonFX],
            "statusname"=>$statusFXName[$randonFX]
        	);
		}elseif($type==2){
 		$arr["bills"][] = array(
            "id" => $i,
            "typeno"=>2,
            "typeintro" =>"",
            "name" => "提现-" . $i,
            "money" =>$i,
            "time"=>"18-08-30 19:55",
            "status"=>$statusTX[$randonTX],
            "statusname"=>$statusTXName[$randonTX]
        	);
		}
        

    }
}else{
	$arr["bills"]=[];
}

$resArr["code"]=200;
$resArr["data"]=$arr;




echo json_encode($resArr);

?>